package com.googlecode.particlesys.templates;

import java.awt.Color;

import com.googlecode.particlesys.objects.AbstractEmitter;
import com.googlecode.particlesys.objects.Particle;

public class Shuriken extends AbstractEmitter {
	
	private int i = 1;
	private double d = 0;

	public Shuriken(int x, int y){
		super(8, 8, x, y, 50, 0);
	}

	@Override
	public Particle getNextParticle(){
		Particle p = new Particle(Color.WHITE, width, height);
		p.setX(x);
		p.setY(y);
		p.setSpeed(16);
		p.setAngle(45*(i+=2)+(d+=3));
		p.setLife(10);
		
		if(i == 9){
			i = 1;
		}
		
		return p;
	}
}